package com.example.demo.service;

import com.example.demo.dao.VideoDAO;
import com.example.demo.entity.Result;
import com.example.demo.entity.Video;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Service
public class VideoService {
    @Autowired
    private VideoDAO videoDAO;

    public List<Video> findAllVideo()
    {
        List<Video> videos;
        videos = videoDAO.findAllVideo();
        return videos;
    }

    public List<Video> listVideoBySearchMsg(String searchMsg, int currentPage){
        return videoDAO.listVideoBySearchMsg(searchMsg,(currentPage-1)*10);
    }
    public int listVideoBySearchMsgTotal(String searchMsg){
        return videoDAO.listVideoBySearchMsgTotal(searchMsg);
    }

    public void deleteVideoById(int id){
        videoDAO.deleteVideoById(id);
    }

    public void editVideo(Video video){
        videoDAO.editVideo(video);
    }

    public void addVideo(Video video){
        videoDAO.addVideo(video);
    }


}
